<%
# Copyright (C) 2016 - present Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
%>

<%
  # these titles are used in more than one spot below
  admin_manage_title = t('Manage')
  admin_delete_title = t("Delete")
  admin_show_rubric_title = t("Show Rubric")
  is_locked = !!js_env.dig(:MASTER_COURSE_DATA, "is_master_course_child_content") &&
              !!js_env.dig(:MASTER_COURSE_DATA, "restricted_by_master_course")
%>
<div class="header-bar-right">
  <div class="header-group-left">
    <span id="quiz_display_points_possible">
      <%= t("Points %{n}", :n => raw("<span style=\"margin-left:5px\" class=\"points_possible\">#{@quiz.points_possible}</span>")) %>
    </span>

    <% if @quiz.published? %>
      <span id='quiz-draft-state' class='published-status published'>
        <i class="icon-publish icon-Solid"></i>
        {{#t}}Published{{/t}}
      </span>
    <% else %>
      <span id='quiz-draft-state' class='published-status unpublished'>
        <i class="icon-unpublished"></i>
        {{#t}}Not Published{{/t}}
      </span>
    <% end %>
  </div>

  <div class="header-group-right">
    <div class="admin-links al-dropdown__container">
      <a class="al-trigger btn" role="button" aria-haspopup="true" aria-owns="manage-toolbar" href="#">
        <i class="icon-settings"></i>
        <i class="icon-mini-arrow-down"></i>
        
      </a>
      <ul id="manage-toolbar" class="al-options" role="menu" tabindex="0" aria-hidden="true" aria-expanded="false">
        <% if @assignment %>
          <li role="presentation">
            <a href="#" rel="<%= context_url(@context, :context_assignment_rubric_url, @assignment.id) %>" class="show_rubric_link" tabindex="-1" role="menuitem">
              <i class="icon-rubric"></i>
              <%= admin_show_rubric_title %>
            </a>
          </li>
          <a href="<%= context_url(@context, :context_rubrics_url) %>" class="icon-rubric" id="add_rubric_url" style="display:none">&nbsp;</a>
        <% end %>
        <% unless is_locked %>
          <li role="presentation">
            <% if @quiz.grants_right?(@current_user, :delete) %>
              <a href="<%= context_url(@context, :context_quiz_url, @quiz) %>" class="delete_quiz_link" tabindex="-1" role="menuitem">
                <i class="icon-trash"></i>
                <%= admin_delete_title %>
              </a>
            <% else %>
              <a class="disabled delete_quiz_link" tabindex="-1" role="menuitem" aria-disabled=true>
                <i class="icon-trash"></i>
                <%= admin_delete_title %>
              </a>
            <% end %>
          </li>
        <% end %>
      </ul>
    </div>

  </div>
</div>
